<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"  >
    <title>用户注册</title>

    <script type="text/javascript">
        //判断用户注册情况
        function checkLength(){
            var domAccount = document.getElementById("account").value;
            var domPassword = document.getElementById("password").value;
            var domUserName = document.getElementById("userName").value;
            if(domAccount.length < 6){
                alert("账号最少输入6字符");
            }else if(domPassword.length < 6){
                alert("密码最少输入6字符");
            }else if(domUserName == ''){
                alert("请输入用户名");
            }
        }
    </script>

</head>
<body>
         <center>
             <form action="/hexu/user/register" method="get">
                 用户账号
                 <input type="text" name="account" id="account" placeholder="账号在6~12个字符之间" size="22"
                        maxlength="12"/>
                 <p>用户密码
                 <input type="text" name="password" id="password" placeholder="密码在6~12个字符之间" size="22"
                        maxlength="12"/></p>
                 <p>用户名
                 <input type="text" name="userName" id="userName" placeholder="不超过20个字符" size="22"
                        maxlength="20"/></p>
                 <p>
                 <input type="submit" value="注册" onclick="checkLength()"/>
                 <input type="reset" /></p>
             </form>

         </center>

</body>
<script>
    document.getElementById("account").required = true;
    document.getElementById("password").required = true;
    document.getElementById("userName").required = true;
</script>

</html>